home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / src / lib / posix / ctermid.c < prev    next >
C/C++ Source or Header  |  1990-07-23  |  641b  |  31 lines

  1. /*  ctermid(3)
  2.  *
  3.  *  Author: Terrence Holm          Aug. 1988
  4.  *
  5.  *
  6.  *  Ctermid(3) returns a pointer to a string naming the controlling
  7.  *  terminal. If <name_space> is NULL then local PRIVATE storage
  8.  *  is used, otherwise <name_space> must point to storage of at
  9.  *  least L_ctermid characters.
  10.  *
  11.  *  Returns a pointer to "/dev/tty".
  12.  */
  13.  
  14. #include <lib.h>
  15. #include <string.h>
  16. #include <stdio.h>
  17.  
  18. #ifndef L_ctermid
  19. #define L_ctermid  9
  20. #endif
  21.  
  22. char *ctermid(name_space)
  23. char *name_space;
  24. {
  25.   PRIVATE char termid[L_ctermid];
  26.  
  27.   if (name_space == (char *)NULL) name_space = termid;
  28.   strcpy(name_space, "/dev/tty");
  29.   return(name_space);
  30. }
  31.